/**
 * FileName: lessonApi.js
 * Author:   Administrator
 * Date:     2021/4/18 9:21
 * Description:
 */
import request, {jsonRequest} from "./request";
const base = '/onlineclass-web/lesson';
const lessonApi = {

    getList(filterParam,sortParam,page,rows) {
        let url = base + '/list.json';
        return request.get(url, {
            params: {filterParam,sortParam,page,rows}
        })
    },

    getOne(id) {
        let url = base + '/findById.json';
        return request.get(url, {
            params: {id}
        })
    },

    deleteItem(id) {
        let url = base + '/delete.json';
        return request.get(url, {
            params: {id}
        })
    },

    addItem(data){
        let url = base + "/save.json";
        return jsonRequest.post(url,data);
    },

    deleteLessonItem(id) {
        let url = base + '/deleteLessonItem.json';
        return request.get(url, {
            params: {id}
        })
    },

    addLessonItem(data){
        let url = base + "/saveLessonItem.json";
        return jsonRequest.post(url,data);
    },

    uploadFile(data,uploadProgressEvent) {
        return jsonRequest({
            url: base + '/importFile.action',
            method: 'post',
            data: data,
            onUploadProgress:uploadProgressEvent
        })
    },


    deleteLessonMedia(id) {
        let url = base + '/deleteLessonMedia.json';
        return request.get(url, {
            params: {id}
        })
    },

}

export default lessonApi;